
{extends file="../acp.html"}

{block name="title"}{$head_title}{/block}

{block name="css"}
<link rel="stylesheet" href="/Public/Css/acp/AcpOrder/order_detail.css" type="text/css" />
<style>
    .delete_icon{
        background-color: #fff;
        border-radius: 50%;
        background-image: url(/Public/Images/front/front_img/dele.png);
        background-size: 25px 25px;
        width: 25px;
        height: 25px;
        display: inline-block;
        position: absolute;
        top:-10px;
        right: -10px;
    }
    .delete_reply{
        background-color: #fff;
        border-radius: 50%;
        background-image: url(/Public/Images/front/front_img/dele.png);
        background-size: 25px 25px;
        width: 25px;
        height: 25px;
        display: inline-block;
        position: relative;
        float: left;
        margin-bottom: -10px;

    }
    .img_class{
        width:100px;
        float:left;
        position:relative;
        margin-right:15px
    }
</style>
{/block}
{block name="content"}
<div class="t-detail-goods">
    <div class="t-detail-goods-tit mag">楼层信息：</div>
    <div class="t-detail-goods-con t-buser">
    	<table class="wxtables tables-form">  
            <colgroup>  
                <col width="10%">  
                <col width="90%">   
            </colgroup>  
            <tbody>
                 <tr>
                     <td class="tables-form-title">昵称：</td>
                     <td>{if $info.nick_name}{$info.nick_name}{else}--{/if}</td>
                 </tr>
                <tr>
                    <td class="tables-form-title">楼层：</td>
					<td>{if $info.floor}{$info.floor}{else}--{/if}</td>
                </tr>
                <tr>
                    <td class="tables-form-title">评论内容：</td>
					<td>
                        {if $info.content}
                        <textarea class="content" style="width: 90%" disabled name="content">{$info.content}</textarea><br/>
                        <span class="btn btn-red edit">修改</span>
                        <div class="operate" style="display: none">
                            <span class="btn btn-blue cancel">取消</span>  <span class="btn btn-blue save" data-post_id="{$info.post_comment_id}" data-content_type="comment">保存</span>
                        </div>
                        {else}--{/if}

                    </td>
                </tr>
                 <tr>
                     <td class="tables-form-title">评论图片：</td>
                     <td>{if $info.img_list}
                         {foreach from =$info.img_list item = img}
                         <div class="img_class">
                             <img src="{$img.img_url}" style="width:100px;">
                             <span class="delete_icon" data-img_id="{$img.comment_img_id}" data-img_type="comment"></span>
                         </div>
                         {/foreach}
                         {else}--{/if}</td>
                 </tr>
                <tr>
                    <td class="tables-form-title">点赞数：</td>
					<td>{if $info.praise_num}{$info.praise_num}{else}--{/if}</td>
                </tr>
                <tr>
                    <td class="tables-form-title">发帖时间：</td>
                    <td>{if $info.acp_time}{$info.acp_time}{else}--{/if}</td>
                </tr>
            </tbody>  
        </table>   
    </div>

    {if $info.comment_hide}
    <div class="t-detail-goods-tit mag">赞赏楼主回帖隐藏评论：</div>
    <div class="t-detail-goods-con t-buser">
        <table class="wxtables tables-form">
            <colgroup>
                <col width="10%">
                <col width="90%">
            </colgroup>
            <tbody>
            <tr>
                <td class="tables-form-title">价格：</td>
                <td>{if  $info.comment_hide.price}{$info.comment_hide.price}{else}--{/if}</td>
            </tr>
            <tr>
                <td class="tables-form-title">评论内容：</td>
                <td>
                    {if  $info.comment_hide.content}
                    <textarea class="content" style="width: 90%" disabled name="content">{$info.comment_hide.content}</textarea><br/>
                    <span class="btn btn-red edit">修改</span>
                    <div class="operate" style="display: none">
                        <span class="btn btn-blue cancel">取消</span>  <span class="btn btn-blue save" data-post_id="{$info.comment_hide.praise_hide_id}" data-content_type="praise">保存</span>
                    </div>
                    {else}--{/if}

                </td>
            </tr>
            <tr>
                <td class="tables-form-title">评论图片：</td>
                <td>{if  $info.comment_hide.hide_imgs_list}
                    {foreach from = $info.comment_hide.hide_imgs_list item = img}
                    <div class="img_class">
                        <img src="{$img.img_url}" style="width:100px;">
                        <span class="delete_icon" data-img_id="{$img.praise_hide_img_id}" data-img_type="praise"></span>
                    </div>
                    {/foreach}
                    {else}--{/if}</td>
            </tr>
            </tbody>
        </table>
    </div>
    {/if}

	<div class="t-detail-goods-tit mag">楼层评论：</div>
    <div class="t-detail-goods-con t-buser">
    	<table class="wxtables tables-form">
            <colgroup>
                <col width="10%">
                <col width="90%">
            </colgroup>
            <tbody>
            {if !$info.reply_comment_list}
            <tr>
                <td>目前该楼层没有评论!</td>
            </tr>
            {else}
            {foreach from = $info.reply_comment_list item = reply}
                <tr>
                    <td class="tables-form-title" ><span class="delete_reply" data-post_comment_id="{$reply.post_comment_id}"></span>用户昵称：</td>
					<td>{if $reply.reply_nick_name}{$reply.reply_nick_name}{else}--{/if}</td>
                </tr>
                <tr style="border-bottom:1px dotted #ddd">
                    <td class="tables-form-title">回复内容：</td>
                    <td>{strip_tags($reply.content)}</td>
                </tr>
                <tr style="height:15px">   </tr>
            {/foreach}
            {/if}
            </tbody>
        </table>
    </div>

	<!--<div class="t-detail-goods-tit mag">收货信息：</div>-->
    <!--<div class="t-detail-goods-con t-buser">-->
    	<!--<table class="wxtables tables-form">  -->
            <!--<colgroup>  -->
                <!--<col width="10%">-->
                <!--<col width="90%">-->
            <!--</colgroup>  -->
            <!--<tbody>  -->
                <!--<tr>  -->
                    <!--<td class="tables-form-title">收货地址：</td>  -->
					<!--<td>{$info.area_string}{$info.address}</td>   -->
                <!--</tr>  -->
            <!--</tbody>  -->
        <!--</table>   -->
    <!--</div>-->
</div>
{/block}
{block name="js"}
<script src="/Public/Plugins/layer/layer.js"></script>
{literal}
<script>
    $('.container').on('click','.delete_icon',function () {
        var img_id = $(this).attr('data-img_id');
        var img_type = $(this).attr('data-img_type');
        console.log('img_id:'+img_id);
        console.log('img_type:'+img_type);

        layer.confirm('是否删除该图片？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.ajax({
                type:'post',
                url:'/AcpPost/del_img',
                data:{img_id:img_id,img_type:img_type},
                success:function (data) {
                    if(data.code == 1){
                        layer.msg(data.msg, {
                            icon:6,
                            time: 1000, //1s后自动关闭
                            end:function () {
                                location.reload();
                            }
                        });
                    }else{
                        layer.msg(data.msg,{icon:5});
                    }
                }
            })
        });
    })


    $('.delete_reply').on('click',function () {
        var comment_id = $(this).attr('data-post_comment_id');

        console.log('comment_id:'+comment_id);

        layer.confirm('是否删除该评论？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.ajax({
                type:'post',
                url:'/AcpPost/del_comment',
                data:{comment_id:comment_id},
                success:function (data) {
                    if(data == 'success'){
                        layer.msg('删除评论成功', {
                            icon:6,
                            time: 1000, //1s后自动关闭
                            end:function () {
                                location.reload();
                            }
                        });
                    }else{
                        layer.msg('删除评论失败',{icon:5});
                    }
                }
            })
        });
    })

    var content = '';
    $('.edit').on('click',function () {
        var _this = $(this);
        content = _this.siblings('.content').val();
        _this.hide();
        _this.siblings('.content').attr('disabled',false);
        _this.siblings('.operate').show();
    })

    $('.cancel').on('click',function () {
        var _this = $(this);
        _this.parent().siblings('.content').val(content);
        _this.parent().hide();
        _this.parent().siblings('.content').attr('disabled',true);
        _this.parent().siblings('.edit').show();
    })

    $('.save').on('click',function () {
        var post_id = $(this).attr('data-post_id');
        var content_type = $(this).attr('data-content_type');
        var content = $(this).parent().siblings('.content').val();
        console.log(post_id);
        console.log(content);
        $.ajax({
            type:'post',
            url:'/AcpPost/edit_post_content',
            data:{post_id:post_id,content:content,content_type:content_type},
            success:function (data) {
                if(data.code == 1){
                    layer.msg(data.msg, {
                        icon:6,
                        time: 1000, //1s后自动关闭
                        end:function () {
                            location.reload();
                        }
                    });
                }else{
                    layer.msg(data.msg,{icon:5});
                }
            }
        })
    })

</script>
{/literal} 
{/block} 
